const SEARCH_HISTORY = 'searchHistory'
export function getItem () {
  try {
    return JSON.parse(localStorage.getItem(SEARCH_HISTORY))
  } catch (err) {
    console.log(err, '获取联想词失败')
    return null
  }
}

export function setItem (data) {
  try {
    localStorage.setItem(SEARCH_HISTORY, JSON.stringify(data))
    return
  } catch (err) {
    console.log(err, '存储联想词失败')
    return null
  }
}

export function removeItem () {
  return localStorage.removeItem(SEARCH_HISTORY)
}
